// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.util;

import java.util.List;

public interface IPooledObject {
    Pool<IPooledObject> getPool();

    void setPool(Pool<IPooledObject> pool);

    void release();

    boolean isFree();

    void setFree(boolean isFree);

    default void onReleased() {
    }

    static void release(IPooledObject[] iPooledObject) {
        int int0 = 0;

        for (int int1 = iPooledObject.length; int0 < int1; int0++) {
            Pool.tryRelease(iPooledObject[int0]);
        }
    }

    static void tryReleaseAndBlank(IPooledObject[] iPooledObject) {
        if (iPooledObject != null) {
            releaseAndBlank(iPooledObject);
        }
    }

    static void releaseAndBlank(IPooledObject[] iPooledObject) {
        int int0 = 0;

        for (int int1 = iPooledObject.length; int0 < int1; int0++) {
            iPooledObject[int0] = Pool.tryRelease(iPooledObject[int0]);
        }
    }

    static void release(List<? extends IPooledObject> list) {
        int int0 = 0;

        for (int int1 = list.size(); int0 < int1; int0++) {
            Pool.tryRelease((IPooledObject)list.get(int0));
        }

        list.clear();
    }
}
